package com.zhuiyun.project.api.teacherReservation.controller;

import com.zhuiyun.project.annotation.OptLog;
import com.zhuiyun.project.api.teacherReservation.model.*;
import com.zhuiyun.project.api.teacherReservation.service.TeacherReservationService;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.utils.constants.CommonConstants;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * @ClassName TeacherReservationController
 * @Description TODO
 * @Author wuwan
 * @Date 2023/11/14 10:22
 **/
@RestController
@RequestMapping("/teacherReservation")
public class TeacherReservationController {
    @Autowired
    TeacherReservationService teacherReservationService;
    /*
     * @Author wuwan
     * @Description 教练端登录pc
     * @Date 2023/11/17 10:05
     * @Return
     */
    @PostMapping("/coachLogin")
    @ApiOperation(value = "教练端登录pc")
    @OptLog(modular = "app教练端",type = CommonConstants.LOGIN,describe = "教练端登录pc")
    public CommonResult coachLogin(@RequestBody CoachLoginModel coachLoginModel){
        return CommonResult.ok(teacherReservationService.coachLogin(coachLoginModel));
    }
    /*
    * @Author wuwan
    * @Description 查询学员预约信息 预约信息对应老师
    * @Date 2023/11/16 8:43
    * @Return
    */
    @GetMapping("/getReservation")
    @ApiOperation(value = "查询学员预约信息")
    @OptLog(modular = "app教练端",type = CommonConstants.SELECT,describe = "查询学员预约信息")
    public CommonResult getReservation(Integer coachId, String reservationStatus, String reservationTime){
        return CommonResult.ok(teacherReservationService.getReservation(coachId,reservationStatus,reservationTime));
    }
    /*
    * @Author wuwan
    * @Description 开始训练方法
    * @Date 2023/11/16 8:42
    * @Return
    */
    @PostMapping("/upReservationStatusOne")
    @ApiOperation(value = "开始训练方法")
    @OptLog(modular = "app教练端",type = CommonConstants.UPDATE,describe = "开始训练方法")
    public CommonResult upReservationStatusOne(@RequestBody UpReservationStatusOneModel upReservationStatusOneModel){
        return CommonResult.ok(teacherReservationService.upReservationStatusOne(upReservationStatusOneModel));
    }
    /*
    * @Author wuwan
    * @Description 结束训练方法
    * @Date 2023/11/16 8:42
    * @Return
    */
    @PostMapping("/upReservationStatusTwo")
    @ApiOperation(value = "结束训练方法")
    @OptLog(modular = "app教练端",type = CommonConstants.UPDATE,describe = "结束训练方法")
    public CommonResult upReservationStatusTwo(@RequestBody UpReservationStatusTwoModel upReservationStatusTwoModel){
        return CommonResult.ok(teacherReservationService.upReservationStatusTwo(upReservationStatusTwoModel.getId(), upReservationStatusTwoModel.getTid()));
    }
    /*
    * @Author wuwan
    * @Description 修改预约课程信息 如调整预约时间 调整课程安排
    * @Date 2023/11/16 8:42
    * @Return
    */
    @PostMapping("/updateReservation")
    @ApiOperation(value = "修改预约课程信息")
    @OptLog(modular = "app教练端",type = CommonConstants.UPDATE,describe = "修改预约课程信息")
    public CommonResult updateReservation(UpdateReservationModel updateReservationModel){
        return CommonResult.ok(teacherReservationService.updateReservation(updateReservationModel));
    }
    /*
    * @Author wuwan
    * @Description 查询计划绑定的动作
    * @Date 2023/11/21 19:07
    * @Return
    */
    @GetMapping("/selectPlanAction")
    @ApiOperation(value = "教练端计划查询")
    @OptLog(modular = "app教练端",type = CommonConstants.LOGIN,describe = "教练端计划查询")
    public CommonResult selectPlanAction(Integer uid){
        return CommonResult.ok(teacherReservationService.selectPlanAction(uid));
    }
    /*
     * @Author wuwan
     * @Description 查询所有动作
     * @Date 2023/11/22 14:43
     * @Return
     */
    @GetMapping("/selectAction")
    @ApiOperation(value = "查询所有动作")
    @OptLog(modular = "app教练端",type = CommonConstants.LOGIN,describe = "查询所有动作")
    public CommonResult selectAction(){
        return CommonResult.ok(teacherReservationService.selectAction());
    }
    /*
    * @Author wuwan
    * @Description 修改课程计划
    * @Date 2023/11/22 14:36
    * @Return
    */
    @PostMapping("/updatePlanAction")
    @ApiOperation(value = "修改课程计划")
    @OptLog(modular = "app教练端",type = CommonConstants.LOGIN,describe = "修改课程计划")
    public CommonResult updatePlanAction(@RequestBody PlanActionModel planActionModel){
        return CommonResult.ok(teacherReservationService.updatePlanAction(planActionModel));
    }
}
